#ifndef POLAR_H_
#define POLAR_H_

#include <math.h>
#include <img.h>

typedef struct polarPointT {
	int r;
	double t;
}polarPointT;

polarPointT cart2polar(pointT p)
{
	polarPointT ret;
	ret.r = sqrt(p.x * p.x + p.y * p.y);
	ret.t = atan(p.x / p.y);
	return ret;
}

pointT polar2cart(polarPointT p, pointT center)
{
	pointT ret;
	ret.x = p.r * cos(p.t) + center.x;
	ret.y = p.r * sin(p.t) + center.y;
	return ret;
}


#endif /*POLAR_H_*/
